﻿using Furion.DatabaseAccessor;
using Microsoft.EntityFrameworkCore;
using System;
using System.Collections.Generic;
using System.ComponentModel.DataAnnotations;
using System.ComponentModel.DataAnnotations.Schema;
using System.Linq;
using System.Text;
using System.Text.Json.Serialization;
using System.Threading.Tasks;

namespace Furion.Core
{

    /// <summary>
    /// 数据字典-配置项
    /// </summary>
    [Comment("数据字典配置项")]
    public class DictionaryItem: IEntity
    {

        public DictionaryItem()
        {
            ParentId = 0;
            Ord = 0;
            IsDeleted =false;
        }

        [Key]
        [DatabaseGeneratedAttribute(DatabaseGeneratedOption.Identity)]
        public int Id { get; set; }

        /// <summary>
        /// 名称
        /// </summary>
        [Required, MaxLength(20)]
        [Comment("名称")]
        public string Name { get; set; }

        /// <summary>
        /// 代码
        /// </summary>
        [MaxLength(20)]
        [Comment("代码")]
        public string Code { get; set; }


        /// <summary>
        /// 上级Id
        /// </summary>
        [Comment("上级Id")]
        public int ParentId { get; set; }


        /// <summary>
        /// 
        /// </summary>
        [Required]
        [Comment("代码")]
        public int DictionaryId { get; set; }


        /// <summary>
        /// 
        /// </summary>
        [Required]
        [Comment("序号")]
        public int Ord { get; set; }


        /// <summary>
        /// 软删除
        /// </summary>
        [JsonIgnore]
        [Comment("软删除标记")]
        public bool IsDeleted { get; set; } = false;


    }
}
